kaldevfandomcom-20200216-history
Setup NPC
'What you need' 1. KalOnline server 2. KalOnline client 3. pk password 4. dat encrypter/decrypter all these things can be found elsewhere so I'll leave the searching to you, this guide is about something different. 'Serverside setup' OK, so all NPCs are stored on the server in MainSvr/Config/InitNPC.txt. The syntax for a NPC looks like this: (gennpc (index I) (country C) (kind K) (shape S) H)/(quest Q Q2) (teleport TM TX TY TZ) (map M) (xy X Y Z) (dir DX DY)) I = unique index of the NPC. try to make it far away from the original Kal npcs, because it might happen that new NPCs will be added and you don't want conflicts do you. C = 252 for international version K = here will be determined what hypertext .dat files will be called from html parameter. Inix has it divided into some classes but hence I can't read korean, I can't translate it very well :] but that doesn't matter, for a basic NPC just use 0''' S = this is the model that will be used for the NPC. There are various numbers from '''1-33 so you can try out how your NPC will come out (a village guard or a tomb stone? ^^) H = this is optional. It's a link to the conversation file in Data/HyperText/e/e.pk in the client. You can either put the last non zero numbers from the name of the file there or the complete number. The filename and structure of the dat will be discussed later in this guide. Q, Q2 = optional too - you can have either a quest NPC or a normal NPC. The first number links to the Quest.txt on the server, where you have quests defined. The second one I'm not sure, you can play with it and let me know :] So leave it at 1''' by default. TM,TX,TY,TZ = here you can specify the coordinates for your NPC to teleport you, if you call the correct function for him. M = map where the NPC is spawned. There are a few maps and you can check this from the coordinates of your character in the database, or just referencing from other NPCs already defined. But just fyi, '''0 is the outside area :] X,Y,Z, DX,DY = coordinates and direction. Just type in /coordinates ingame and you can get your coordinates :] for direction are mostly used the X and Y coordinates, but when you want your NPC to look other way, just play around with them OK so now we have a NPC set up in a server and it doesn't show any errors. So on to the next step. 'Clientside setup' Of course a NPC will be seen by the player even if the client doesn't contain its name and other things. But it will show as NULL and you can't talk to it. So we will make a patch for the client. Extract the files in config.pk and e.pk somewhere. First we will add the NPCs name in the client. This is stored in the message-e.dat. Decrypt it, open it in notepad and find the part which contains the npc names. Add a row at the end of that part that looks like this: ( npcname I "My New NPC") I = the unique ID you specified on the server earlier. Close the dat, save it, encrypt it again and put it back into the config.pk. Next we will add the custom dialogue/html for our NPC, so we can talk to it :] These files are stored in e.pk so we need to extract that. There you can see lots of files that are named sKNNNNN.dat K = kind, so when you made an NPC with kind parameter 0, the file will be named s0... NNNNN = a unique number for the given dialogue. This you have added in the html parameter in the server. if it's for example 700, the file will be named s000700.dat (kind 0 ofc). Now the syntax for the file is: Code: (filechk file_ver (country_type ENG) (filename sKNNNNN)) (background (font 12) (wrap 270) (link system ( param ( width 270) ( height 255) ( style title edge system vscroll) ( caption "Caption") ( layout script) )) ) ( frame ( font 12) ( line "text text text") ( line "blablabla") ( line "") ( link ( text "Store Let's go shopping") ( param load "store" S)) ( link ( text "Tell me something more") ( param load "sKNNNNN" )) ( link ( text "Teleport me somewhere") ( param load "teleportNPC1" )) ( link close ( text "Talking Bye Bye")) ) Now watch out for the things you can change here. You can change a lot :] From the layout itself to what's being said and what's being done. Caption is a caption of the dialog window ofc :] You can add lines with text with the (line "xxx") (param load "store" S) = S is the number if the store. Stores are defined in macro.dat and are not covered in this guide, but you can figure it out ;] (param load "sKNNNNN") loads a different dialogue window which (a sKNNNNN.dat file) so you can make a large conversation this way :] (param load "teleportNPC1") = teleports you to the coordinates you specified on the server. (link close ... closes the dialogue :] Save this file with the correct filename, encrypt it and put it into the e.pk. And if you haven't made some mistake (or if I haven't done something wrong :>), you should have your own NPC spawned into kalworld :] Category:Tutorial Category:NPC Category:Setup Category:Help